package com.testmall.utils;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.testmall.entity.common.PageBean;
import com.testmall.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author: k23
 * @Date: 2022-06-27 15:33
 * @Version: 1.0
 */

public class PageUtils {
    @Autowired
    OrdersService Ordersservice;
    public PageBean getpage(Map map) {
        PageHelper.startPage(MapUtils.getPageNumValue(map),MapUtils.getPageSizeValue(map));
        List list=Ordersservice.queryOrder(map);
        Page page= (Page) list;
        return new PageBean(page.getPageNum(),page.getPageSize(),page.getTotal(),page.getPages(),list);
    }

}
